from flask import Flask, current_app

import common
from xtoad.settings import settings


def create_app():
    from . import models, schema, routes, services, auth
    app = Flask(__name__)

    app.config.from_object(settings['active'])
    common.init_app(app)
    models.init_app(app)
    schema.init_app(app)
    routes.init_app(app)
    services.init_app(app)
    auth.init_app(app)

    print("created app")

    return app
